﻿@{
    ViewBag.Title = @HCQ2_Common.LangHelper.GetValue("ScoreManager.scoreStatistics");
}
@section headerSection{
    <style>
        #exampleToolbar > .form-group {
            float: left;
            margin: 0;
            margin-left: 5px;
        }
    </style>
}
<div class="animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins" style="margin-bottom: 0px;">
        <div class="ibox-content" style="padding: 5px 20px 0px 20px;">
            <div class="row row-lg">
                <div class="col-sm-12 col-sm-leftRight">
                    <!-- Example Toolbar -->
                    <div class="example">
                        <div class="btn-group hidden-xs" id="exampleToolbar" role="group">
                            <div class="form-group" style="margin-left:0;width:110px;">
                                <input id="userName" name="userName" type="text" class="form-control" placeholder="@HCQ2_Common.LangHelper.GetValue("ScoreManager.teacherName")">
                            </div>
                            <div class="form-group" style="width:110px;">
                                <input id="fileCode" name="fileCode" type="text" class="form-control" placeholder="@HCQ2_Common.LangHelper.GetValue("ScoreManager.workCode")">
                            </div>
                            <div class="form-group" style="width:150px;">
                                <input id="inDate" name="inDate" type="text" class="laydate-icon form-control input-sm" placeholder="@HCQ2_Common.LangHelper.GetValue("ScoreManager.startDate")" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" />
                            </div>
                            <div class="form-group" style="width:150px;">
                                <input id="endDate" name="endDate" type="text" class="laydate-icon form-control input-sm" placeholder="@HCQ2_Common.LangHelper.GetValue("ScoreManager.endDate")"  onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" />
                            </div>
                            <div class="form-group">
                                <button id="btnSearch" class="btn btn-primary" type="button"><i class="fa fa-search"></i>&nbsp;@HCQ2_Common.LangHelper.GetValue("GeneralJson.Query")</button>
                            </div>
                            <div class="form-group">
                                <button id="btnExport" class="btn btn-success" type="button"><i class="fa fa-download"></i>&nbsp;@HCQ2_Common.LangHelper.GetValue("GeneralJson.Export")</button>
                                <a id="aExport" href='' style="display:none;"><span>a</span></a>
                            </div>
                        </div>
                        <table id="exampleTableToolbar" data-mobile-responsive="true" data-radio="true"></table>
                    </div>
                    <!-- End Example Toolbar -->
                </div>
            </div>
        </div>
    </div>
    <!-- End Panel Other -->
</div>
@section footSection{
    <script>
        var $table, options;
        var experRecordManager = {
            //1.0 初始化页面
            initPage: function () {
                parent.showLoadBoxs();
                experRecordManager.initTable();
                experRecordManager.bindEvent();
                parent.delLoadBoxs();
                $('#aExport').attr("href", ctx + "/VLinesManager/ExportTable");
            },
            //1.1 初始化Table
            initTable: function () {
                options = {
                    url: ctx + "/VLinesManager/InitTable",
                    cutHeight: 5,
                    toolbar: "#exampleToolbar",
                    queryParams: function (params) {
                        params = {
                            rows: params.limit,
                            //页面大小
                            page: params.offset / params.limit + 1,
                            user_name: $('#userName').val(),//用户名、登录名
                            file_code: $('#fileCode').val(),//体验代码                          
                            start_date: $('#inDate').val(),//进入时间
                            end_date: $('#endDate').val()//退出时间
                        }
                        return params;
                    },
                    columns: [
                    {
                        radio: true
                    }, {
                        field: '',//第一列序号
                        title: Lang.VRGoodManager.VRCloudWork.number,
                        align: 'center',
                        width: 50,
                        formatter: function (value, row, index) {
                            return index + 1;
                        }
                    },
                    {
                        field: 'file_code',
                        title: Lang.ScoreManager.workCode,
                        align: 'center'
                    },
                    {
                        field: 'file_name',
                        title: Lang.ScoreManager.workName,
                        align: 'center'
                    },
                    {
                        field: 'user_name',
                        title: Lang.ScoreManager.teacherName,
                        align: 'center'
                    },{
                        field: 'cr_name',
                        title: Lang.ScoreManager.lineName,
                        align: 'center'
                    }, {
                        field: 'folder_code',
                        title: Lang.ScoreManager.folderCode,
                        align: 'center'
                    }, {
                        field: 'num',
                        title: Lang.ScoreManager.num,
                        align: 'center'
                    }, {
                        field: 'accuracy',
                        title: Lang.ScoreManager.accuracy,
                        align: 'center',
                        formatter: function (value, row, index) {
                            if (value)
                                return value + "%";
                            return "";
                        }
                    }, {
                        field: 'result_ok',
                        title: Lang.ScoreManager.rightNum,
                        align: 'center'
                    }, {
                        field: 'result_error',
                        title: Lang.ScoreManager.errorNum,
                        align: 'center'
                    },
                    {
                        field: 'create_date',
                        title: Lang.GeneralJson.createDate,
                        align: 'center'
                    }, {
                        field: 'content',
                        title: Lang.ScoreManager.titleContent,
                        align: 'center'
                    }, {
                        field: 'answer',
                        title: Lang.ScoreManager.rightAnswer,
                        align: 'center',
                        formatter: function (value, row, index) {
                            if (value) {
                                if (value.length > 15)
                                    return "<span title='" + value + "'>" + value.substring(0, 15) + "...</span>";
                                return value;
                            }
                            return "";
                        }
                    }, {
                        field: 'parse',
                        title: Lang.ScoreManager.parse,
                        align: 'center',
                        formatter: function (value, row, index) {
                            if (value) {
                                if (value.length > 15)
                                    return "<span title='" + value + "'>" + value.substring(0, 15) + "...</span>";
                                return value;
                            }
                            return "";
                        }
                    }],
                    onClickRow: function (row, $element) {
                    }
                }
                $table = tableHelper.initTable("exampleTableToolbar", options);
            },
            //绑定默认事件
            bindEvent: function () {
                //查询
                $('#btnSearch').click(function () {
                    $table.bootstrapTable('refresh', options);
                });
                //导出
                $('#btnExport').on('click', function () {
                    var index = layer.msg("数据处理中...");
                    var user_name = $('#userName').val(), fileCode = $('#fileCode').val(), inDate = $('#inDate').val(), endDate = $('#endDate').val();
                    if (user_name)
                        user_name = encodeURI(user_name);
                    var _href = ctx + "/VLinesManager/ExportTable?userName=" + user_name + "&fileCode=" + fileCode + "&startDate=" + inDate + "&endDate=" + endDate;
                    $('#aExport').attr("href", _href);
                    $("#aExport span").trigger("click");//模拟执行id=aExport的事件
                });
            }
        }
        $(function () {
            experRecordManager.initPage();
        });
    </script>
}